﻿@model IEnumerable<CloudStorageLight.Core.AccessLog>
@{
    ViewBag.Title = "LogView";
    Layout = "~/Views/Shared/_Layout.cshtml";
    var accountName = CloudStorageLight.Core.BlobService.GetCurrentDomain();

}

<h2>LogView</h2>

@using (Html.BeginForm())
{
    <table cellpadding="5">
        <tr>
            <td>@(CloudStorageLight.Core.Web.ViewMessages.MsgUsageSize)</td>
            <td>@(CloudStorageLight.Core.Web.WebUtil.GetUsedStoargeSizeString(accountName))</td>
            <td colspan="3"></td>
        </tr>
        @*<tr>
                <td>@(CloudStorageLight.Core.Web.ViewMessages.MsgFullTextEntryServerName)</td>
                <td>@(contInfo.FullTextExecuteServerName)</td>
            </tr>*@
        <tr>
            <td></td>
            <td>@(CloudStorageLight.Core.Web.ViewMessages.MsgFrom)@Html.TextBox("fromDate", null, new { style = "width:100px;" })</td>
            <td>@(CloudStorageLight.Core.Web.ViewMessages.MsgTo)@Html.TextBox("toDate", null, new { style = "width:100px;" })</td>
            <td>@(CloudStorageLight.Core.Web.ViewMessages.MsgUser)@Html.TextBox("userName", null, new { style = "width:100px;" })</td>
            <td>@(CloudStorageLight.Core.Web.ViewMessages.MsgAction)@Html.TextBox("actionName", null, new { style = "width:100px;" })</td>
            <td><input type="submit" value="@(CloudStorageLight.Core.Web.ViewMessages.MsgExecute)" /></td>
        </tr>
    </table>

}


@if (Model != null)
{
    <table class="logview-table">
        <tr>
            <th style="width:10%;">Date</th>
            <th style="width:10%;">Action</th>
            <th style="width:20%;">Path</th>
            <th style="width:10%;">User</th>
            <th style="width:10%;">IPaddress</th>
            <th>Remark</th>
        </tr>
        @foreach (var item in Model.OrderByDescending(x => x.Date))
        {
            <tr>
                <td>
                    @item.Date.ToString("yyyy/MM/dd HH:mm:ss fff")
                </td>
                <td>
                    @(item.Action ?? "")
                </td>
                <td>
                    @(item.Path ?? "")
                </td>
                <td>
                    @(item.UserName ?? "")
                </td>
                <td>
                    @(item.IPAddress ?? "")
                </td>
                <td>
                    @(item.Additional ?? "")
                </td>
            </tr>
        }
    </table>
}

